/*
 * 
 * Copyright (C) 2010 Wilfried Elmenreich, Anita Sobe 
 * This file is part of VideoNetwork.
 * 
 * VideoNetwork is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
 * You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. 
 */
package proxy;

public class Migration implements Comparable<Migration> {
	private VideoUnit videoUnit;
	private Link link;
	private boolean copy;
	private Double importance;

	Migration(VideoUnit videoUnit, Link link, boolean copy, Double importance) {
		this.videoUnit = videoUnit;
		this.link = link;
		this.copy = copy;
		this.importance = importance;
	}

	public VideoUnit getVideoUnit() {
		return videoUnit;
	}

	@Override
	public boolean equals(Object obj) {
		return ((Migration) obj).videoUnit.getId() == videoUnit.getId();
	}

	@Override
	public int hashCode() {
		return new Integer(videoUnit.getId()).hashCode();
	}

	public int compareTo(Migration o) {
		if (importance > o.importance)
			return 1;
		if (importance < o.importance)
			return -1;
		return 0;
	}

	public Link getLink() {
		return link;
	}

	public boolean isCopy() {
		return copy;
	}

	public Double getImportance() {
		return importance;
	}

	public void setCopy(boolean copy) {
		this.copy = copy;
	}

}
